// TCPSocketServerDlg.h

#pragma once

#include "resource.h"
#include "TCPSocketDef.h"

class TCPSocketServer;

class TCPSocketServerDlg : public CDialogEx
{
    DECLARE_DYNAMIC(TCPSocketServerDlg)

public:
    enum
    {
        IDD = IDD_TCPSocket_Server
    };

public:
    static TCPSocketServerDlg* GetInstance(CWnd* pParent = NULL);
    static BOOL IsInitialize();

public:
    void SetCloseCallBack(CLOSE_SERVER_DIALOG_CALLBACK callbackCloseDialog);

protected:
    TCPSocketServerDlg(CWnd* pParent = NULL);
    virtual ~TCPSocketServerDlg();
    void UnInitialize();

public:
    afx_msg void OnBnClickedOpenServer();
    afx_msg void OnBnClickedCloseServer();
    afx_msg void OnBnClickedCancelServer();

public:
    virtual BOOL PreTranslateMessage(MSG* pMsg);

protected:
    virtual void DoDataExchange(CDataExchange* pDX);

    DECLARE_MESSAGE_MAP()

private:
    static TCPSocketServerDlg* m_pSocketServerDlg;
    std::unique_ptr<TCPSocketServer> m_spTCPSocketServer;
    CLOSE_SERVER_DIALOG_CALLBACK m_callbackCloseDialog;
};
